package com.ruoyi.business.common.riskRule;

import com.ruoyi.business.Vo.RulePremiseVo;
import com.ruoyi.business.service.ICreditService;
import com.ruoyi.common.utils.spring.SpringUtils;
import org.springframework.stereotype.Service;

@Service
class CreditRule implements RuleStrategy {

    @Override
    public String getType() {
        return CREDIT;
    }

    @Override
    public int applyInfoExpire(String fingerprint, String custNo,String excludeSerialNo) {
        return 0;
    }

    @Override
    public boolean fingerprintsSame(Object currentFingerprint, String excludeSerialNo, String custNo) {
        return false;
    }

    @Override
    public void rulePremise(RulePremiseService rulePremiseService, RulePremiseVo rulePremiseVo, String... columnK) {

        if (!rulePremiseService.operationFlag(rulePremiseVo, columnK)) {
            return;
        }
        ICreditService creditService = SpringUtils.getBean(ICreditService.class);
        creditService.rulePass(rulePremiseVo.getSerialNo());
    }

    @Override
    public void rulePremiseV228(RulePremiseService rulePremiseService, RulePremiseVo rulePremiseVo) {

        if (!rulePremiseService.operationFlagV228(rulePremiseVo)) {
            return;
        }
        passToRisk(rulePremiseVo);
    }

    @Override
    public void passToRisk(RulePremiseVo rulePremiseVo) {
        ICreditService creditService = SpringUtils.getBean(ICreditService.class);
        creditService.rulePass(rulePremiseVo.getSerialNo());
    }


}
